const Router = require('koa-router')
const router = new Router({ prefix: '/users' })
const { register, login, changePassword } = require('../controller/user.controller')
const { userValidator, verifyUser, cryptPassword, verifyLogin } = require('../middleware/user.middleware')
const { auth } = require('../middleware/auth.middleware')

router.post('/register', userValidator, verifyUser, cryptPassword, register)
router.post('/login', verifyLogin, login)
router.patch('/changePass', auth, cryptPassword, changePassword)

module.exports = router